#include "BaseNode.h"

BaseNode::BaseNode(QWidget*parent)
	: QWidget(parent)
{

}

BaseNode::BaseNode(int id, int parentId, int type, const QString& text, QWidget* parent):
	m_id(id),m_type(type),m_text(text), QWidget(parent)
{
}

void BaseNode::init(int id, int parentId, int type, const QString& text)
{
	setId(id);
	setParentId(parentId);
	setType(type);
	setText(text);
}

void BaseNode::reName(const QString& newName)
{
	this->setText(newName);
}

void BaseNode::addChild(QTreeWidgetItem* item)
{
	QTreeWidgetItem::addChild(item);
}

void BaseNode::setId(quint64 id)
{
	m_id = id;
}

void BaseNode::setParentId(quint64 parentId)
{
	m_parentId = parentId;
}

void BaseNode::setType(int type)
{
	m_type = type;
}

void BaseNode::setText(const QString& text)
{
	m_text = text;
	QTreeWidgetItem::setText(0, text);
	QTreeWidgetItem::setText(1, TYPE_MAPPING[getType()]);
}

quint64 BaseNode::getId()
{
	return m_id;
}

quint64 BaseNode::getParentId()
{
	return m_parentId;
}

int BaseNode::getType()
{
	return m_type;
}

quint64 BaseNode::getId() const
{
	return m_id;
}

quint64 BaseNode::getParentId() const
{
	return m_parentId;
}

int BaseNode::getType() const
{
	return m_type;
}

QString BaseNode::getText()
{
	return m_text;
}

QString BaseNode::getText() const
{
	return m_text;
}

BaseNode::~BaseNode()
{}

